import React from 'react'
import {
  View,
  StyleSheet,
  Text, ScrollView, Image
} from 'react-native'
import { ScaleS, ScaleT } from 'src/utils/ScreenUtil'
import BaseJobExpected from 'src/pageP/base/base-job-expected'
import NextButton from 'src/components/button/NextButton'

class UserJobExpected extends BaseJobExpected {
  constructor (props) {
    super(props)
    const {
      navigation: {
        state: { params: { workCategory, workNature } }
      }
    } = this.props
    this.state = {
      ...this.state,
      workNature,
      workCategory: workCategory || this.state.workCategory
    }
  }

  renderBottomBtn () {
    const { workCategory } = this.state
    return (
      <NextButton style={styles.nextButton} title="保存" enable={workCategory.length > 0} onPress={this.nextButtonClick}/>
    )
  }

  /**
   * 下一步
   * @private
   */
  nextButtonClick = () => {
    const { workCategory } = this.state
    if (!workCategory.length) {
      return
    }
    const {
      navigation: {
        state: { params: { callback } }
      }
    } = this.props
    callback && callback(workCategory)
    this.goBack()
  }
}
export default UserJobExpected

const styles = StyleSheet.create({
  jobNatureIndexView: {
    flexDirection: 'row',
    alignItems: 'flex-end'
  },
  jobNatureIndex: {
    color: '#999999',
    fontSize: ScaleT(20),
    fontWeight: '500'
  },
  jobNatureTotal: {
    color: '#999999',
    fontSize: ScaleT(16),
    fontWeight: '500'
  },
  nextButton: {
    position: 'absolute',
    bottom: ScaleS(20),
    left: ScaleS(32)
  }
})
